package d6_map_impl;


import java.util.ArrayList;
import java.util.List;

/**
 * code实例：使用sort方法
 * @Atuhor:Cjj
 * @Date：2025/5/26
 */
public class Main {
    public static void main(String[] args) {
        testArraySort();
        System.out.println();
        
    }

    private static void testArraySort() {
        int[][] intervals = new int[][]{{1,6},{3,5},{2,4}};
        print(intervals,"intial sequence");

    }

    private static void print(int[][] intervals, String msg) {
        System.out.println(msg);
        for(int[]pr: intervals){
            System.out.println(pr[0]+""+pr[1]+",");
        }
    }

    public static void testListSort(){
        List<List<Integer>> arr=new ArrayList<>();
        for(int i=0; i<4;i++){
            arr.add(new ArrayList<>());
            arr.get(i).add(i);
            arr.get(i).add(-(i+2));
        }

        System.out.println("initial sequence");
        System.out.println(arr);

        //lambda expression 类型推导,类似auto关键字;
        System.out.println("sort(desc) using 1st option");
        System.out.println(arr);

        System.out.println("sort(desc)using 2nd option");
        System.out.println(arr);

        System.out.println("sort(asc) using 2nd option");
        System.out.println(arr);

        System.out.println("sort(asc) using 1st option");
        System.out.println(arr);

        System.out.println("sort(asc) using 2nd option");
        System.out.println(arr);

        System.out.println("sort(asc) using 3st option");

        System.out.println(arr);
        System.out.println("sort(asc) using 4st option");
    }
}
